﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MyDelegate
{
    public class Greeting
    {
        public delegate void SayHiHander(string name);
        public static void SayHi(string name, PeopleType type)
        {
            if (type == PeopleType.Chiness)
                Console.WriteLine("早上好,{0}", name);
            else if (type == PeopleType.American)
                Console.WriteLine("GoodMoring,{0}", name);
        }

        public enum PeopleType
        {
            Chiness,
            American
        }

        public static void SayHiDelegate(string name, SayHiHander sayHi)
        {
            sayHi(name);
        }

        public static void SayHiChinese(string name)
        {
            Console.WriteLine("早上好,{0}",name);
        }

        public static void SayHiAmerican(string name)
        {
            Console.WriteLine("Morning,{0}", name);
        }

    }
}
